import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    name:"Index",
    redirect: '/home',  // 重定向:重新指向其它path,会改变网址
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect:"/home/homePage",// 重定向:重新指向其它path,会改变网址
  
    children:[
      {
        path: 'homePage',
        name: 'HomePage',
        component: () => import(/* webpackChunkName: "about" */ '../views/home/HomePage.vue'),
        meta:{
          icon:"star-o",
          title:"首页"
        }
      },
      {
        path: 'classify',
        name: 'Classify',
        component: () => import(/* webpackChunkName: "about" */ '../views/home/Classify.vue'),
        meta:{
          icon:"star-o",
          title:"分类"
        }
      },
      {
        path: 'jingXi',
        name: 'JingXi',
        component: () => import(/* webpackChunkName: "about" */ '../views/home/JingXi.vue'),
        meta:{
          icon:"star-o",
          title:"京喜"
        }
      },
      {
        path: 'shopCar',
        name: 'ShopCar',
        component: () => import(/* webpackChunkName: "about" */ '../views/home/ShopCar.vue'),
        meta:{
          icon:"star-o",
          title:"购物车"
        }
      },
      {
        path: 'my',
        name: 'My',
        component: () => import(/* webpackChunkName: "about" */ '../views/home/My.vue'),
        meta:{
          icon:"star-o",
          title:"未登录"
        }
      },
    ]
  },
  {
    path:"/detail/:id",
    name:"Detail",
    component: () => import(/* webpackChunkName: "about" */ '../views/Detail.vue')
  },
  {
    path:"/login",
    name:"Login",
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
  },
  {
    path:"/address",
    name:"Address",
    component: () => import(/* webpackChunkName: "about" */ '../views/Address.vue')
  },{
    path:"/addressown",
    name:"Addressown",
    component: () => import(/* webpackChunkName: "about" */ '../views/Addressown.vue')
  },
  {
    path:"/detail2",
    name:"Detail2",
    component: () => import(/* webpackChunkName: "about" */ '../views/Detail2.vue')
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
